package com.study.spring.ch03.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value="/ch03/method/**") //①处理器的通用映射前缀
public class ReqMethodTestController {

	@RequestMapping(value="/create", method = RequestMethod.GET)//②类级别的@RequestMapping窄化
	public String showForm() {
		System.out.println("===============GET");
		return "ch03/create";
	}

	@RequestMapping(value="/create", method = RequestMethod.POST)//③类级别的@RequestMapping窄化
	public String submit() {
		System.out.println("================POST");
		return "redirect:/success";
	}
	
}
